﻿<Page:BasePage
    xmlns:Page="clr-namespace:Tfs.OnTheRoad.Pages"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
	xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
	xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:Controls="clr-namespace:Tfs.OnTheRoad.Controls"
    xmlns:converters="clr-namespace:Tfs.OnTheRoad.Converters"
	mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="800"
	x:Class="Tfs_OnTheRoad.BuildDetailsPage"
	FontFamily="{StaticResource PhoneFontFamilyNormal}"
	FontSize="{StaticResource PhoneFontSizeNormal}"
	Foreground="{StaticResource PhoneForegroundBrush}"
	SupportedOrientations="Portrait" Orientation="Portrait"  ApplicationBarButtons="Refresh,About,Back,GoToWorkItem" 
	shell:SystemTray.IsVisible="True">
    <!--Enabling Page Transitions-->
    <toolkit:TransitionService.NavigationInTransition>
        <toolkit:NavigationInTransition>
            <toolkit:NavigationInTransition.Backward>
                <toolkit:TurnstileTransition Mode="BackwardIn"/>
            </toolkit:NavigationInTransition.Backward>
            <toolkit:NavigationInTransition.Forward>
                <toolkit:TurnstileTransition Mode="ForwardIn"/>
            </toolkit:NavigationInTransition.Forward>
        </toolkit:NavigationInTransition>
    </toolkit:TransitionService.NavigationInTransition>
    <toolkit:TransitionService.NavigationOutTransition>
        <toolkit:NavigationOutTransition>
            <toolkit:NavigationOutTransition.Backward>
                <toolkit:TurnstileTransition Mode="BackwardOut"/>
            </toolkit:NavigationOutTransition.Backward>
            <toolkit:NavigationOutTransition.Forward>
                <toolkit:TurnstileTransition Mode="ForwardOut"/>
            </toolkit:NavigationOutTransition.Forward>
        </toolkit:NavigationOutTransition>
    </toolkit:TransitionService.NavigationOutTransition>

    <phone:PhoneApplicationPage.Resources>
        <converters:BuildImageConverter x:Key="BuildImageConverter"></converters:BuildImageConverter>
    </phone:PhoneApplicationPage.Resources>
    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="*"></RowDefinition>
        </Grid.RowDefinitions>
        <Controls:HeaderControl Grid.Row="0"  x:Name="HeaderControlPage"  NavigationPath="Build Details"></Controls:HeaderControl>
        
        <!--Pivot Control-->
        <controls:Pivot Grid.Row="1">
            <controls:PivotItem Header="General">              
                    <ScrollViewer Margin="10,0,10,0">
                        <StackPanel ScrollViewer.VerticalScrollBarVisibility="Auto">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <Image Grid.Column="0" Grid.RowSpan="2" Grid.Row="0" Width="28" HorizontalAlignment="Center"  Source="{Binding Status,Converter={StaticResource BuildImageConverter}}" VerticalAlignment="Center"></Image>
                            <TextBlock Grid.Column="1" Text="{Binding Number, Converter={StaticResource LongStringEllipsisConverter},ConverterParameter=150}" VerticalAlignment="Center" Grid.Row="0" Style="{StaticResource PhoneTextTitle2Style}" FontSize="34" Foreground="{StaticResource PhoneAccentBrush}" Margin="10,10,10,0" TextWrapping="Wrap"/>
                            <TextBlock Grid.Column="1" Grid.Row="1" Text="{Binding Definition}" Foreground="{StaticResource PhoneAccentBrush}" Style="{StaticResource PhoneTextTitle3Style}" FontSize="22" Margin="8,0" />
                        </Grid>
                        <StackPanel Visibility="{Binding Project, Converter={StaticResource FieldHasValueVisibilityConverter}}">
                                <TextBlock Text="Project" Foreground="{StaticResource PhoneAccentBrush}" Style="{StaticResource PhoneTextTitle3Style}" FontSize="22" Margin="8,0"  Height="27" VerticalAlignment="Top" />
                                <TextBlock Text="{Binding Project}" Style="{StaticResource PhoneTextTitle3Style}" FontSize="22" Margin="8,0" TextWrapping="Wrap" />
                            </StackPanel>
                            <StackPanel Visibility="{Binding Status, Converter={StaticResource FieldHasValueVisibilityConverter}}">
                                <TextBlock Text="Status" Foreground="{StaticResource PhoneAccentBrush}" Style="{StaticResource PhoneTextTitle3Style}" FontSize="22" Margin="8,0"  />
                                <TextBlock Text="{Binding Status}" Style="{StaticResource PhoneTextTitle3Style}" FontSize="22" Margin="8,0" TextWrapping="Wrap" />
                            </StackPanel>
                            <StackPanel Visibility="{Binding Quality, Converter={StaticResource FieldHasValueVisibilityConverter}}">
                                <TextBlock Text="Quality" Foreground="{StaticResource PhoneAccentBrush}" Style="{StaticResource PhoneTextTitle3Style}" FontSize="22" Margin="8,0"  />
                                <TextBlock Text="{Binding Quality}" Style="{StaticResource PhoneTextTitle3Style}" FontSize="22" Margin="8,0" />
                            </StackPanel>
                            <StackPanel Visibility="{Binding RequestedBy, Converter={StaticResource FieldHasValueVisibilityConverter}}">
                                <TextBlock Text="Requested By" Foreground="{StaticResource PhoneAccentBrush}" Style="{StaticResource PhoneTextTitle3Style}" FontSize="22" Margin="8,0"  />
                                <TextBlock Text="{Binding RequestedBy}" Style="{StaticResource PhoneTextTitle3Style}" FontSize="22" Margin="8,0" TextWrapping="Wrap" />
                            </StackPanel>
                            <StackPanel Visibility="{Binding RequestedFor, Converter={StaticResource FieldHasValueVisibilityConverter}}">
                                <TextBlock Text="Requested For" Foreground="{StaticResource PhoneAccentBrush}" Style="{StaticResource PhoneTextTitle3Style}" FontSize="22" Margin="8,0"  />
                                <TextBlock Text="{Binding RequestedFor}" Style="{StaticResource PhoneTextTitle3Style}" FontSize="22" Margin="8,0" TextWrapping="Wrap" />
                            </StackPanel>
                            <StackPanel Visibility="{Binding LastChangedBy, Converter={StaticResource FieldHasValueVisibilityConverter}}">
                                <TextBlock Text="Last Changed By" Foreground="{StaticResource PhoneAccentBrush}" Style="{StaticResource PhoneTextTitle3Style}" FontSize="22" Margin="8,0"  />
                                <TextBlock Text="{Binding LastChangedBy}" Style="{StaticResource PhoneTextTitle3Style}" FontSize="22" Margin="8,0" TextWrapping="Wrap" />
                            </StackPanel>
                            <StackPanel Visibility="{Binding StartTime, Converter={StaticResource FieldHasValueVisibilityConverter}}">
                                <TextBlock Text="Start Time" Foreground="{StaticResource PhoneAccentBrush}" Style="{StaticResource PhoneTextTitle3Style}" FontSize="22" Margin="8,0"  />
                                <TextBlock Text="{Binding StartTime}" Style="{StaticResource PhoneTextTitle3Style}" FontSize="22" Margin="8,0" TextWrapping="Wrap" />
                            </StackPanel>
                            <StackPanel Visibility="{Binding FinishTime, Converter={StaticResource FieldHasValueVisibilityConverter}}">
                                <TextBlock Text="Finish Time" Foreground="{StaticResource PhoneAccentBrush}" Style="{StaticResource PhoneTextTitle3Style}" FontSize="22" Margin="8,0"  />
                                <TextBlock Text="{Binding FinishTime}" Style="{StaticResource PhoneTextTitle3Style}" FontSize="22" Margin="8,0" TextWrapping="Wrap" />
                            </StackPanel>
                            <StackPanel Visibility="{Binding LastChangedOn, Converter={StaticResource FieldHasValueVisibilityConverter}}">
                                <TextBlock Text="Last Changed On" Foreground="{StaticResource PhoneAccentBrush}" Style="{StaticResource PhoneTextTitle3Style}" FontSize="22" Margin="8,0"  />
                                <TextBlock Text="{Binding LastChangedOn}" Style="{StaticResource PhoneTextTitle3Style}" FontSize="22" Margin="8,0" TextWrapping="Wrap" />
                            </StackPanel>
                            <StackPanel Visibility="{Binding BuildFinished, Converter={StaticResource FieldHasValueVisibilityConverter}}">
                                <TextBlock Text="Build Finished" Foreground="{StaticResource PhoneAccentBrush}" Style="{StaticResource PhoneTextTitle3Style}" FontSize="22" Margin="8,0"  />
                                <TextBlock Text="{Binding BuildFinished}" Style="{StaticResource PhoneTextTitle3Style}" FontSize="22" Margin="8,0" TextWrapping="Wrap" />
                            </StackPanel>
                            <StackPanel Visibility="{Binding DropLocation, Converter={StaticResource FieldHasValueVisibilityConverter}}">
                                <TextBlock Text="Drop Location" Foreground="{StaticResource PhoneAccentBrush}" Style="{StaticResource PhoneTextTitle3Style}" FontSize="22" Margin="8,0"  />
                                <TextBlock Text="{Binding DropLocation}" Style="{StaticResource PhoneTextTitle3Style}" FontSize="22" Margin="8,0" TextWrapping="Wrap" />
                            </StackPanel>
                            <StackPanel Visibility="{Binding Warnings, Converter={StaticResource FieldHasValueVisibilityConverter}}">
                                <StackPanel Orientation="Horizontal">
                                    <Image Source="/Images/BuildWarning.png" Width="24" VerticalAlignment="Center" HorizontalAlignment="Center"></Image>
                                    <TextBlock Text="Warnings" Foreground="{StaticResource PhoneAccentBrush}" Style="{StaticResource PhoneTextTitle3Style}" FontSize="22" Margin="8,0"  />
                                </StackPanel>
                                <TextBlock Text="{Binding Warnings}" Style="{StaticResource PhoneTextTitle3Style}" FontSize="22" Margin="8,0" TextWrapping="Wrap" />
                            </StackPanel>
                            <StackPanel Visibility="{Binding Errors, Converter={StaticResource FieldHasValueVisibilityConverter}}">
                                <StackPanel Orientation="Horizontal">
                                    <Image Source="/Images/BuildErrors.png" Width="24" VerticalAlignment="Center" HorizontalAlignment="Center"></Image>
                                    <TextBlock Text="Errors" Foreground="{StaticResource PhoneAccentBrush}" Style="{StaticResource PhoneTextTitle3Style}" FontSize="22" Margin="8,0"  />
                                </StackPanel>
                                <TextBlock Text="{Binding Errors}" Style="{StaticResource PhoneTextTitle3Style}" FontSize="22" Margin="8,0" TextWrapping="Wrap" />
                            </StackPanel>
                    </StackPanel>                        
                    </ScrollViewer>
            </controls:PivotItem>

            <controls:PivotItem Header="Changesets">
                <Controls:ChangesetsListControl ProgressBarVisibility="Visible" x:Name="ChangesetsListControl"></Controls:ChangesetsListControl>
            </controls:PivotItem>

            <controls:PivotItem Header="Work Items">
                <Controls:WorkItemsListControl x:Name="WorkItemsListControl"></Controls:WorkItemsListControl>
            </controls:PivotItem>            
        </controls:Pivot>
        <Controls:FindWorkItemPanel Grid.RowSpan="2" Visibility="Collapsed" VerticalAlignment="Top" />
    </Grid>
</Page:BasePage>